home *** CD-ROM | disk | FTP | other *** search
/ TPUG - Toronto PET Users Group / TPUG Users Group CD / TPUG Users Group CD.iso / AMIGA / (A)U / (A)U5.ADF / NGC / ngc.a < prev    next >
Text File  |  1989-11-12  |  41KB  |  1,711 lines

  1. main:        bra    main1
  2.  
  3. civer:        dc.b    'NGC Ver: 00162  02-Aug-89 05:33:18',$0a
  4.         dc.b    'Copyright (C) 1989, Ulf Nordquist.',$0a,0
  5. civerend:
  6.  
  7. ;    Nordquist Generic Checker
  8. ;    complete program
  9.  
  10. ;    This source code is released into the public domain for
  11. ;    non-profit use only.
  12. ;    Copyright (C) 1989, Ulf Nordquist. All Rights Reserved !
  13. ;    Ulf Nordquist
  14. ;    Brunnehagen 36
  15. ;    417 47 Gothenburg
  16. ;    Sweden
  17.  
  18. ;    History
  19. ;    890725 : first (open & closedev from me)
  20. ;         read block 0 & 1
  21. ;         check against a normal bootblock
  22. ;    890726 : check all attached floppy drives
  23. ;         handle drive with no disk
  24. ;         report only disks of boot type
  25. ;    890727 : check disks as they are inserted
  26. ;         open control window when error is found
  27. ;         save boot blocks as ordinary file
  28. ;    890728 : write standard boot blocks on disk
  29. ;         chkcnt & instcnt & vircnt
  30. ;    890729 : menu button opens control window
  31. ;           special gadgets only then
  32. ;             force check of boot blocks
  33. ;             change current drive +/-
  34. ;    890731 : compare with saved bootblocks
  35. ;         run from workbench
  36. ;    890801 : check resident library jump table
  37. ;    890802 : check resident device jump table
  38.  
  39. ;    amiga system routine offsets
  40.  
  41. _LVOActivateGadget equ    -462
  42. _LVOAddPort    equ    -354
  43. _LVOAllocMem    equ    -198
  44. _LVOAllocSignal equ    -330
  45. _LVOAutoRequest equ    -348
  46. _LVOClose    equ    -36
  47. _LVOCloseDevice equ    -450
  48. _LVOCloseLibrary equ    -414
  49. _LVOCloseWindow equ    -72
  50. _LVOCurrentDir    equ    -126
  51. _LVODisplayBeep equ    -96
  52. _LVODoIO    equ    -456
  53. _LVODrawBorder    equ    -108
  54. _LVOExamine    equ    -102
  55. _LVOExNext    equ    -108
  56. _LVOFindName    equ    -276
  57. _LVOFindResident equ    -96
  58. _LVOFindTask    equ    -294
  59. _LVOForbid    equ    -132
  60. _LVOFreeMem    equ    -210
  61. _LVOFreeSignal    equ    -336
  62. _LVOGetMsg    equ    -372
  63. _LVOLock    equ    -84
  64. _LVOModifyIDCMP equ    -150
  65. _LVOOpen    equ    -30
  66. _LVOOpenDevice    equ    -444
  67. _LVOOpenLibrary equ    -552
  68. _LVOOpenWindow    equ    -204
  69. _LVOOutput    equ    -60
  70. _LVOPrintIText    equ    -216
  71. _LVORead    equ    -42
  72. _LVORemPort    equ    -360
  73. _LVOReplyMsg    equ    -378
  74. _LVOUnLock    equ    -90
  75. _LVOWait    equ    -318
  76. _LVOWaitPort    equ    -384
  77. _LVOWrite    equ    -48
  78.  
  79. ;    amiga sytem structs offsets and sizes
  80.  
  81. DeviceList    equ    350    ;struct, LH
  82. IOSTD_SIZE    equ    48    ;total IOStdReq size
  83. IO_ACTUAL    equ    32    ;long, actual bytes
  84. IO_COMMAND    equ    28    ;word, device command
  85. IO_DATA     equ    40    ;ptr, data
  86. IO_LENGTH    equ    36    ;long, req bytes
  87. IO_OFFSET    equ    44    ;long, for seek devs
  88. LIB_NEGSIZE    equ    16    ;word, bytes before lib
  89. LIB_POSSIZE    equ    18    ;word, bytes after lib
  90. LIB_SIZE    equ    34    ;total size
  91. LibList     equ    378    ;struct, LH
  92. LN_NAME     equ    10    ;ptr
  93. LN_TYPE     equ    8    ;byte
  94. MN_LENGTH    equ    18    ;word, size of nxt block
  95. MN_REPLYPORT    equ    14    ;ptr
  96. MN_SIZE     equ    20    ;total message size
  97. MP_FLAGS    equ    14    ;byte
  98. MP_SIGBIT    equ    15    ;byte
  99. MP_SIGTASK    equ    16    ;ptr
  100. MP_SIZE     equ    34    ;total MsgPort size
  101. NT_MSGPORT    equ    4
  102. RT_INIT     equ    22    ;ptr,  to init code
  103. fib_SIZEOF    equ    260    ;total FileInfoBlock size
  104. fib_DirEntryType equ    4    ;long
  105. fib_FileName    equ    8    ;108 bytes, null term string
  106. fib_Size    equ    124    ;long
  107. gg_GadgetID    equ    38    ;word
  108. im_IAddress    equ    28    ;ptr
  109. im_Class    equ    20    ;long
  110. im_Code     equ    24    ;word
  111. nw_LeftEdge    equ    0    ;word, initial Window dim
  112. nw_TopEdge    equ    2    ;word, initial Window dim
  113. pr_CLI        equ    172    ;bptr, to ConsoleLineInterpreter
  114. pr_MsgPort    equ    92    ;struct, this is BPTR addr from DOS
  115. wd_LeftEdge    equ    4    ;word
  116. wd_RPort    equ    50    ;ptr
  117. wd_TopEdge    equ    6    ;word
  118. wd_UserPort    equ    86    ;ptr
  119.  
  120. ;    amiga system constants
  121.  
  122. ACCESS_READ    equ    -2
  123. ACTIVATE    equ    $1000        ;when Window opens, it's the Active one
  124. BOOLGADGET    equ    $0001
  125. CLOSEWINDOW    equ    $00000200
  126. CMD_NONSTD    equ    9        ;first individual cmd
  127. CMD_READ    equ    2        ;standard read
  128. CMD_UPDATE    equ    4        ;write all buffers
  129. CMD_WRITE    equ    3        ;standard write
  130. DISKINSERTED    equ    $00008000
  131. FALSE        equ    0
  132. GADGDISABLED    equ    $0100
  133. GADGETUP    equ    $00000040
  134. GADGHCOMP    equ    $0000
  135. MEMF_ANY    equ    $0
  136. MEMF_CHIP    equ    $2
  137. MEMF_CLEAR    equ    $10000
  138. MEMF_PUBLIC    equ    $1
  139. MENUDOWN    equ    $69        ;empirically deduced
  140. MODE_NEWFILE    equ    1006
  141. MODE_OLDFILE    equ    1005
  142. MOUSEBUTTONS    equ    $00000008
  143. NOCAREREFRESH    equ    $00020000    ; not to be bothered with REFRESH
  144. NUMSECS     equ    11
  145. PA_SIGNAL    equ    0
  146. RELVERIFY    equ    $0001
  147. RMBTRAP     equ    $00010000    ;Catch RMB events for your own
  148. RP_JAM2     equ    1
  149. SELECTED    equ    $0080
  150. STRGADGET    equ    $0004
  151. TD_CHANGENUM    equ    CMD_NONSTD+4
  152. TD_CHANGESTATE    equ    CMD_NONSTD+5
  153. TD_MOTOR    equ    CMD_NONSTD+0
  154. TD_PROTSTATUS    equ    CMD_NONSTD+6
  155. TD_SECTOR    equ    512
  156. TRUE        equ    ~FALSE
  157. WBENCHSCREEN    equ    $0001
  158. WINDOWCLOSE    equ    $0008
  159. WINDOWDEPTH    equ    $0004
  160. WINDOWDRAG    equ    $0002
  161. _AbsExecBase    equ    4
  162.  
  163. ;    equates
  164. ;    ascii control
  165.  
  166. lf        equ    $0a
  167.  
  168. ;    parameters for all windows
  169.  
  170. chrh        equ    7        ;character height
  171. chrw        equ    8        ;character width
  172. strbufsiz    equ    30        ;no of chrs in string gadget buffers
  173. windp        equ    0        ;detail pen
  174. winbp        equ    1        ;block pen
  175.  
  176. ;    startup window parameters
  177.  
  178. winx        equ    253-3*chrw    ;top x
  179. winy        equ    0        ;top y
  180. winw        equ    85+3*chrw    ;width
  181. winh        equ    chrh+3        ;height
  182. winidcmp    equ    CLOSEWINDOW+DISKINSERTED+MOUSEBUTTONS ;idcmp flags
  183.  
  184. ;    control window parameters
  185.  
  186. ctlwinx     equ    0        ;init top x
  187. ctlwiny     equ    0        ;init top y
  188. ctlwinw     equ    308        ;width
  189. ctlwinh     equ    75        ;height
  190.  
  191. ;    control window text
  192.  
  193. ctlmsgx     equ    chrw        ;status message
  194. ctlmsgy     equ    13
  195. ctlcdx        equ    ctlmsgx     ;current drive msg
  196. ctlcdy        equ    ctlmsgy+chrh+5
  197. ctlcddx     equ    ctlcdx+19*chrw    ;current drive digit
  198. ctlcddy     equ    ctlcdy
  199.  
  200. ;    control window gadgets
  201. ;    id # (do not change values)
  202.  
  203. coid        equ    0
  204. fnid        equ    1
  205. said        equ    2
  206. inid        equ    3
  207. chid        equ    4
  208. plid        equ    5
  209. miid        equ    6
  210. cpid        equ    7
  211.  
  212. ;    continue
  213.  
  214. ctlcox        equ    10        ;box top x
  215. ctlcoy        equ    40        ;box top y
  216. ctlcow        equ    8*chrw+4    ;width
  217. ctlcoh        equ    chrh+4        ;height
  218. ctlcotx     equ    ctlcox+2    ;text top x
  219. ctlcoty     equ    ctlcoy+2    ;text top y
  220.  
  221. ;    save
  222.  
  223. ctlsax        equ    ctlcox+ctlcow+5 ;box top x
  224. ctlsay        equ    ctlcoy        ;box top y
  225. ctlsaw        equ    4*chrw+4    ;width
  226. ctlsah        equ    chrh+4        ;height
  227. ctlsatx     equ    ctlsax+2    ;text top x
  228. ctlsaty     equ    ctlsay+2    ;text top y
  229.  
  230. ;    install
  231.  
  232. ctlinx        equ    ctlsax+ctlsaw+5 ;box top x
  233. ctliny        equ    ctlcoy        ;box top y
  234. ctlinw        equ    7*chrw+4    ;width
  235. ctlinh        equ    chrh+4        ;height
  236. ctlintx     equ    ctlinx+2    ;text top x
  237. ctlinty     equ    ctliny+2    ;text top y
  238.  
  239. ;    check
  240.  
  241. ctlchx        equ    ctlinx+ctlinw+5 ;box top x
  242. ctlchy        equ    ctlcoy        ;box top y
  243. ctlchw        equ    5*chrw+4    ;width
  244. ctlchh        equ    chrh+4        ;height
  245. ctlchtx     equ    ctlchx+2    ;text top x
  246. ctlchty     equ    ctlchy+2    ;text top y
  247.  
  248. ;    compare
  249.  
  250. ctlcpx        equ    ctlchx+ctlchw+5 ;box top x
  251. ctlcpy        equ    ctlcoy        ;box top y
  252. ctlcpw        equ    7*chrw+4    ;width
  253. ctlcph        equ    chrh+4        ;height
  254. ctlcptx     equ    ctlcpx+2    ;text top x
  255. ctlcpty     equ    ctlcpy+2    ;text top y
  256.  
  257. ;    plus
  258.  
  259. ctlplx        equ    ctlcddx+3*chrw    ;box top x
  260. ctlply        equ    ctlcddy-2    ;box top y
  261. ctlplw        equ    3*chrw+4    ;width
  262. ctlplh        equ    chrh+4        ;height
  263. ctlpltx     equ    ctlplx+2    ;text top x
  264. ctlplty     equ    ctlply+2    ;text top y
  265.  
  266. ;    minus
  267.  
  268. ctlmix        equ    ctlplx+ctlplw+20 ;box top x
  269. ctlmiy        equ    ctlply        ;box top y
  270. ctlmiw        equ    3*chrw+4    ;width
  271. ctlmih        equ    chrh+4        ;height
  272. ctlmitx     equ    ctlmix+2    ;text top x
  273. ctlmity     equ    ctlmiy+2    ;text top y
  274.  
  275. ;    file name
  276.  
  277. ctlfnx        equ    16*chrw     ;top x
  278. ctlfny        equ    60        ;top y
  279. ctlfnw        equ    20*chrw+2    ;width
  280. ctlfnh        equ    chrh+3        ;height
  281. ctlfntx     equ    ctlmsgx     ;text top x
  282. ctlfnty     equ    ctlfny        ;text top y
  283.  
  284. ;    memory error requester
  285.  
  286. memreqw     equ    250        ;width
  287. memreqh     equ    70        ;height
  288.  
  289. ;    chkone error codes (do not change values)
  290.  
  291. nodev        equ    1
  292. nomem        equ    2
  293. nodsk        equ    3
  294. nochg        equ    4
  295. nobot        equ    5
  296. nocod        equ    6
  297. noclr        equ    7
  298.  
  299. ;    startup errors
  300.  
  301. nodos        equ    25
  302. noint        equ    20
  303. nowin        equ    15
  304.  
  305. ;    various
  306.  
  307. bootsize    equ    2*TD_SECTOR    ;size of bootblock
  308. brainst     equ    %0110000000000000 ;long
  309. jmpinst     equ    %0100111011111001 ;jmp abs.l
  310. libver        equ    33        ;1.2 and later
  311. moveqinst    equ    %0111000000000000 ;with reg & data = 0
  312. moveqmask    equ    %1111000100000000 ;mask reg & data
  313. nopinst     equ    %0100111001110001
  314. numdrv        equ    4        ;maximum number of drives
  315. romend        equ    $ffffff     ;last byte in rom
  316. romstart    equ    $fc0000     ;1:st byte in rom
  317. trkbufsiz    equ    bootsize    ;size of disk read buffer
  318.  
  319. ;    the program continues here
  320.  
  321.         ds.w    0        ;alignment
  322.  
  323. main1:        move.l    a7,spsave
  324.         move.l    _AbsExecBase,a6
  325.         move.l    a6,d7
  326.  
  327. ;    open DOS
  328.  
  329.         lea    dosname(pc),a1          ;ptr name string
  330.         moveq.l #libver,d0        ;ver #
  331.         jsr    _LVOOpenLibrary(a6)
  332.         moveq.l #nodos,d5        ;error code
  333.         move.l    d0,dosbase
  334.         beq    exit1            ;if no DOS
  335.  
  336. ;    determine who started us
  337.  
  338.         suba.l    a1,a1
  339.         jsr    _LVOFindTask(a6)
  340.         clr.l    -(a7)                   ;flg no wbmsg
  341.         move.l    d0,a0
  342.         tst.l    pr_CLI(A0)
  343.         bne.s    main2            ;if started by CLI
  344.  
  345. ;    started by workbench
  346. ;    get message from workbench
  347.  
  348.         lea    pr_MsgPort(a0),a2       ;msg port ptr
  349.         move.l    a2,a0
  350.         jsr    _LVOWaitPort(a6)
  351.         move.l    a2,a0            ;msg port ptr
  352.         jsr    _LVOGetMsg(a6)
  353.         move.l    d0,(a7)                 ;use msg later
  354.         bra.s    main3
  355.  
  356. ;    get stdout handle
  357.  
  358. main2:        move.l    dosbase(pc),a6
  359.         jsr    _LVOOutput(a6)
  360.         move.l    d0,d1            ;output handle
  361.  
  362. ;    output copyright message
  363.  
  364.         moveq.l #civerend-civer,d3    ;len
  365.         move.l    #civer,d2        ;txt ptr
  366.         jsr    _LVOWrite(a6)           ;write
  367.  
  368. ;    open intuition
  369.  
  370. main3:        move.l    d7,a6            ;_AbsExecBase
  371.         lea    intname(pc),a1          ;ptr name string
  372.         moveq.l #libver,d0        ;ver #
  373.         jsr    _LVOOpenLibrary(a6)
  374.         moveq.l #noint,d5        ;flg no intuition
  375.         move.l    d0,intbase
  376.         beq    exit2            ;if no intuition
  377.  
  378. ;    open window
  379.  
  380.         move.l    d0,a6
  381.         lea    window(pc),a0           ;window ptr
  382.         jsr    _LVOOpenWindow(a6)
  383.         moveq.l #nowin,d5        ;flg no window
  384.         move.l    d0,-(a7)                ;window ptr
  385.         beq    exit3            ;if no window
  386.  
  387. ;    perform initial checks
  388.  
  389.         move.l    d7,a6            ;_AbsExecBase
  390.         bsr    chkall
  391.         move.l    (a7),a3                 ;window ptr
  392.         bsr    memchk
  393.  
  394. ;    wait for somethimg to happen
  395.  
  396. event:        move.l    (a7),a0                 ;window ptr
  397.         move.l    wd_UserPort(a0),a2      ;IDCMP ptr
  398.         move.b    MP_SIGBIT(a2),d1        ;sigbit #
  399.         moveq.l #1,d0
  400.         asl.l    d1,d0            ;sigbit mask
  401.         jsr    _LVOWait(a6)
  402.         move.l    a2,a0            ;IDCMP ptr
  403.         jsr    _LVOGetMsg(a6)
  404.         tst.l    d0
  405.         beq.s    event            ;if no msg
  406.  
  407. ;    IDCMP received
  408.  
  409.         move.l    d0,a1            ;ptr msg
  410.         move.l    im_Class(a1),d3         ;IDCMP class
  411.         move.w    im_Code(a1),d4
  412.         jsr    _LVOReplyMsg(a6)
  413.         cmp.l    #CLOSEWINDOW,d3
  414.         beq    exit            ;if close window
  415.         cmp.l    #MOUSEBUTTONS,d3
  416.         beq.s    event1            ;if a mouse button
  417.         cmp.l    #DISKINSERTED,d3
  418.         bne.s    event            ;if not a new disk
  419.  
  420. ;    a disk is inserted
  421.  
  422.         bsr    chkall
  423.         bra.s    event            ;wait for nxt
  424.  
  425. ;    a mouse button is pressed
  426.  
  427. event1:     cmp.w    #MENUDOWN,d4
  428.         bne.s    event            ;if no menu button
  429.  
  430. ;    menu button is pressed
  431.  
  432.         moveq.l #0,d4
  433.         move.b    lastdrv(pc),d4          ;last drive used
  434.         bsr    reschgcnt        ;force chg
  435.         bsr    chkone
  436.         tst.l    d5
  437.         beq.s    event11         ;if no error
  438.         subq.l    #nomem+1,d5
  439.         bmi.s    event            ;if nodev/mem
  440.  
  441. ;    turn off IDCMP
  442.  
  443. event11:    move.l    intbase(pc),a6
  444.         move.l    (a7),a0                 ;window ptr
  445.         moveq.l #0,d0
  446.         jsr    _LVOModifyIDCMP(a6)
  447.  
  448. ;    enable special gadgets
  449.  
  450.         lea    ctlch(pc),a0
  451.         move.l    a0,ctlfn        ;link in special gadgets
  452.         lea    ctltxtch(pc),a0
  453.         move.b    #ctlchtx,(a0)           ;special texts
  454.         lea    ctlbrdch(pc),a0
  455.         move.w    #ctlchx,(a0)            ;special borders
  456.         bsr.s    reqstr
  457.  
  458. ;    turn on IDCMP
  459.  
  460.         move.l    (a7),a0                 ;window ptr
  461.         move.l    #winidcmp,d0
  462.         jsr    _LVOModifyIDCMP(a6)
  463.         move.b    d4,lastdrv        ;last drive used
  464.         move.l    d7,a6            ;_AbsExecBase
  465.         bsr    chkoneend
  466.  
  467. ;    disable special gadgets
  468.  
  469.         moveq.l #0,d0
  470.         move.l    d0,ctlfn        ;remove special gadgets
  471.         lea    ctltxtch(pc),a0
  472.         move.b    d0,(a0)                 ;special texts
  473.         lea    ctlbrdch(pc),a0
  474.         move.w    d0,(a0)                 ;special borders
  475.         bra    event
  476.  
  477. ;    normal end cleanup
  478.  
  479. exit:        moveq.l #0,d5            ;exit code
  480.  
  481. ;    close startup window
  482.  
  483.         move.l    intbase(pc),a6
  484.         move.l    (a7)+,a0                ;window ptr
  485.         jsr    _LVOCloseWindow(a6)
  486.  
  487. ;    if no startup window
  488.  
  489. exit3:        move.l    d7,a6            ;_AbsExecBase
  490.         move.l    intbase(pc),a1
  491.         jsr    _LVOCloseLibrary(a6)    ;close intuition
  492.  
  493. ;    if no intuition.library
  494.  
  495. exit2:        move.l    dosbase(pc),a1
  496.         jsr    _LVOCloseLibrary(a6)    ;close dos
  497.  
  498. ;    if no dos.library
  499.  
  500. exit1:        move.l    (a7)+,d2                ;wbmsg ptr
  501.         beq.s    exit4            ;if started from workbench
  502.  
  503. ;    reply workbench message
  504.  
  505.         jsr    _LVOForbid(a6)
  506.         move.l    d2,a1
  507.         jsr    _LVOReplyMsg(a6)
  508. exit4:        move.l    spsave(pc),a7           ;defensive programming
  509.         move.l    d5,d0            ;exit code
  510.         rts
  511.  
  512. ;    reqstr
  513. ;    open control window and handle user response
  514. ;    entry : d4=trackdisk unit number
  515. ;        a3=trackdisk ioreq ptr, a4=track buf ptr, a5=status str ptr
  516. ;    exit  : d4=trackdisk unit (possibly updated), a6=intbase
  517. ;    chg   : d0,d1,d2,d3,d4,d5,d6
  518. ;        a0,a1,a2,a5,a6
  519. ;    4,6-9,12,14->
  520.  
  521. reqstr:     move.l    intbase(pc),a6
  522.         lea    ctlwin(pc),a0           ;window ptr
  523.         jsr    _LVOOpenWindow(a6)
  524.         tst.l    d0
  525.         bne.s    reqstr11
  526.         rts                ;exit if no window
  527. reqstr11:    move.l    a4,d6            ;track buf ptr
  528.         move.l    d0,a4            ;win ptr
  529.  
  530. ;    display fixed text
  531.  
  532.         lea    ctltxt(pc),a2           ;fixed text ptr
  533. reqstr1:    moveq.l #0,d0
  534.         move.l    d0,d1
  535.         move.b    (a2)+,d0                ;x coord
  536.         beq.s    reqstr3         ;if no more
  537.         move.b    (a2)+,d1                ;y coord
  538.         move.l    a2,genitptr        ;txt ptr
  539. reqstr2:    tst.b    (a2)+
  540.         bne.s    reqstr2         ;loop until end of str
  541.         bsr    prttxt
  542.         bra.s    reqstr1         ;print text
  543.  
  544. ;    display fixed border boxes
  545.  
  546. reqstr3:    lea    ctlbrd(pc),a2           ;fixed border ptr
  547. reqstr13:    moveq.l #0,d0
  548.         move.l    d0,d1
  549.         move.w    (a2),d2
  550.         beq.s    reqstr5         ;if no more
  551.         move.l    a2,genbdptr        ;coord ptr
  552.         add.w    #5*2*2,a2        ;next box coords
  553.         move.l    wd_RPort(a4),a0         ;rast port ptr
  554.         lea    genbd(pc),a1            ;ptr to border struct
  555.         jsr    _LVODrawBorder(a6)
  556.         bra.s    reqstr13        ;loop
  557.  
  558. ;    event loop
  559. ;    display drive digit
  560.  
  561. reqstr5:    move.l    intbase(pc),a6
  562.         lea    bbdigit(pc),a0
  563.         move.b    d4,(a0)
  564.         add.b    #'0',(a0)               ;make ascii
  565.         move.l    a0,genitptr        ;intuitext string ptr
  566.         moveq.l #ctlcddx/2,d0
  567.         add.l    d0,d0            ;x coord
  568.         moveq.l #ctlcddy,d1        ;y coord
  569.         bsr    prttxt
  570.  
  571. ;    display status message
  572.  
  573.         move.l    a5,genitptr        ;intuitext string ptr
  574.         beq.s    reqstr10        ;if no msg
  575.         moveq.l #ctlmsgx,d0        ;x coord
  576.         moveq.l #ctlmsgy,d1        ;y coord
  577.         bsr    prttxt
  578.         sub.l    a5,a5            ;flg no msg
  579.  
  580. ;    wait for event
  581.  
  582. reqstr10:    move.l    d7,a6            ;_AbsExecBase
  583.         move.l    wd_UserPort(a4),a2      ;IDCMP ptr
  584.         move.b    MP_SIGBIT(a2),d1        ;sigbit #
  585.         moveq.l #1,d0
  586.         asl.l    d1,d0            ;sigbit mask
  587.         jsr    _LVOWait(a6)
  588.         move.l    a2,a0            ;IDCMP ptr
  589.         jsr    _LVOGetMsg(a6)
  590.         tst.l    d0
  591.         beq.s    reqstr5         ;if no msg
  592.         move.l    d0,a1            ;ptr msg
  593.         move.l    im_Class(a1),d2         ;IDCMP class
  594.         move.l    im_IAddress(a1),a2      ;gadget ptr
  595.         jsr    _LVOReplyMsg(a6)
  596.         cmp.l    #DISKINSERTED,d2
  597.         beq    reqch            ;if a new disk, chk it
  598.         cmp.l    #GADGETUP,d2
  599.         bne.s    reqstr5         ;if not gadget
  600.         moveq.l #0,d1
  601.         move.w    gg_GadgetID(a2),d1
  602.  
  603. ;    do the requested routine
  604. ;    routines must not destroy d4,d6,a3,a4
  605.  
  606.         beq    reqco            ;if continue
  607.         subq.l    #2,d1
  608.         beq.s    reqsa            ;if save
  609.         subq.l    #1,d1
  610.         beq.s    reqin            ;if install
  611.         subq.l    #1,d1
  612.         beq    reqfch            ;if forced check
  613.         subq.l    #1,d1
  614.         beq    reqpl            ;if plus
  615.         subq.l    #1,d1
  616.         beq    reqmi            ;if minus
  617.         subq.l    #1,d1
  618.         beq    reqcp            ;if compare
  619.         bra    reqstr5         ;if unkown
  620.  
  621. ;    save bootblock
  622.  
  623. reqsa:        move.l    dosbase(pc),a6
  624.         move.l    #strbuf,d1        ;name ptr
  625.         move.l    #MODE_NEWFILE,d2    ;mode
  626.         jsr    _LVOOpen(a6)
  627.         move.l    d0,d1            ;handle
  628.         move.l    d0,d5
  629.         beq    reqerr            ;if no handle
  630.         move.l    d6,d2            ;data ptr
  631.         move.l    #trkbufsiz,d3        ;data size
  632.         jsr    _LVOWrite(a6)
  633.         move.l    d0,d2            ;if open error
  634.         move.l    d5,d1            ;handle
  635.         jsr    _LVOClose(a6)
  636.         addq.l    #1,d2
  637.         bne    reqstr5         ;cont event loop
  638.  
  639. ;    save, install error
  640.  
  641. reqerr:     move.l    intbase(pc),a6
  642.         sub.l    a0,a0            ;all screens
  643.         jsr    _LVODisplayBeep(a6)
  644.         bra    reqstr5         ;cont event loop
  645.  
  646. ;    install disk
  647. ;    check if there is a disk in the drive
  648.  
  649. reqin:        bsr    tdstate
  650.         bne    reqstr5         ;if no disk
  651.  
  652. ;    get a new trackbuffer
  653.  
  654.         move.l    #TD_SECTOR,d0
  655.         move.l    #MEMF_CHIP+MEMF_CLEAR,d1
  656.         jsr    _LVOAllocMem(a6)        ;get mem ptr
  657.         tst.l    d0
  658.         beq.s    reqerr            ;if no mem
  659.         move.l    d0,a2            ;buf ptr
  660.  
  661. ;    check if disk is write protected
  662.  
  663.         move.w    #TD_PROTSTATUS,IO_COMMAND(a3)
  664.         bsr    doiotst
  665.         lea    bbwpmsg(pc),a5
  666.         bne.s    reqin3            ;if write prot
  667.  
  668. ;    write block 1 & 0
  669.  
  670.         moveq.l #1,d2            ;write 2 blocks
  671.         move.l    #TD_SECTOR,IO_OFFSET(a3) ;block 1
  672. reqin2:     move.l    a2,IO_DATA(a3)          ;data ptr
  673.         move.l    #TD_SECTOR,IO_LENGTH(a3) ;data size
  674.         move.w    #CMD_WRITE,IO_COMMAND(a3) ;write
  675.         bsr    doiotst
  676.         moveq.l #(bootend-bootstart)/4-1,d0 ;normal boot code size
  677.         move.l    a2,a1            ;buf ptr
  678.         lea    bootstart(pc),a0        ;normal code ptr
  679. reqin1:     move.l    (a0)+,(a1)+
  680.         dbra    d0,reqin1        ;move norm code to buffer
  681.         clr.l    IO_OFFSET(a3)           ;block 0
  682.         dbra    d2,reqin2        ;write block 0
  683.  
  684. ;    put it on the disk
  685.  
  686.         move.w    #CMD_UPDATE,IO_COMMAND(a3)
  687.         bsr    doiotst
  688.         bsr    motoroff
  689.         lea    bb0msg(pc),a5
  690.         add.w    #1,instcnt        ;one more installed
  691.  
  692. ;    free this track buffer
  693.  
  694. reqin3:     move.l    a2,a1            ;ptr
  695.         move.l    #TD_SECTOR,d0        ;size
  696.         jsr    _LVOFreeMem(a6)
  697.         bra    reqstr5         ;cont event loop
  698.  
  699. ;    close window
  700.  
  701. reqco:        move.l    a4,a0            ;win ptr
  702.         move.l    d6,a4            ;track buf ptr
  703.         move.l    intbase(pc),a6
  704.         lea    ctlwin(pc),a1           ;NewWindow ptr
  705.         move.w    wd_LeftEdge(a0),nw_LeftEdge(a1)
  706.         move.w    wd_TopEdge(a0),nw_TopEdge(a1) ;update init pos
  707.         jmp    _LVOCloseWindow(a6)
  708.  
  709. ;    forced check of drive
  710.  
  711. reqfch:     bsr    reschgcnt
  712.  
  713. ;    normal check of drive
  714.  
  715. reqch:        exg    a4,d6            ;d6=ctl ptr a4=trkbuf
  716.         move.l    a3,d0
  717.         beq.s    reqch1            ;if no io req
  718.         bsr    chkoneend
  719. reqch1:     bsr    reschgcnt        ;force chk
  720.         bsr    chkone
  721.         exg    a4,d6            ;a4=ctl ptr d6=trkbuf
  722.         tst.l    d5
  723.         beq    reqstr5         ;if no error
  724.         subq.l    #nomem+1,d5
  725.         bpl    reqstr5         ;if successful open
  726.         sub.l    a3,a3            ;no io req
  727.  
  728. ;    decrease drive number
  729.  
  730. reqmi:        subq.l    #1,d4            ;prev drive #
  731.         bpl.s    reqch            ;if valid, go chk it
  732.         addq.l    #1,d4
  733.         bra    reqstr5
  734.  
  735. ;    increase drive number
  736.  
  737. reqpl:        addq.l    #1,d4            ;nxt drive #
  738.         cmp.b    #numdrv-1,d4
  739.         ble.s    reqch            ;if valid, go chk it
  740.         subq.l    #1,d4
  741.         bra    reqstr5
  742.  
  743. ;    compare with saved
  744. ;    allocate memory for FileInfoBlock and read buffer
  745.  
  746. reqcp:        move.l    #fib_SIZEOF+trkbufsiz,d0
  747.         move.l    #MEMF_ANY,d1
  748.         jsr    _LVOAllocMem(a6)        ;get mem ptr
  749.         move.l    d0,a2            ;ptr
  750.         tst.l    d0
  751.         beq    reqerr            ;if no mem
  752.  
  753. ;    get lock to compare directory
  754.  
  755.         move.l    dosbase(pc),a6
  756.         move.l    #cpdev,d1        ;dir name
  757.         move.l    ACCESS_READ,d2
  758.         jsr    _LVOLock(a6)
  759.         move.l    d0,d5            ;dir lock
  760.         beq    reqcp2            ;if no lock
  761.         move.l    d0,d1            ;dir lock
  762.         jsr    _LVOCurrentDir(a6)
  763.  
  764. ;    get FileInfoBlock for compare directory
  765.  
  766.         move.l    a2,d2            ;fib ptr
  767.         move.l    d5,d1            ;dir lock
  768.         jsr    _LVOExamine(a6)
  769.         tst.l    d0
  770.         beq    reqcp3            ;if error
  771.  
  772. ;    get FileInfoBlock for next file
  773.  
  774. reqcp5:     move.l    d5,d1            ;dir lock
  775.         move.l    a2,d2            ;fib ptr
  776.         jsr    _LVOExNext(a6)
  777.         tst.l    d0
  778.         beq.s    reqcp3            ;if no more entries
  779.         tst.l    fib_DirEntryType(a2)
  780.         bgt.s    reqcp5            ;if a directory, try next
  781.  
  782. ;    a file is found
  783.  
  784.         cmp.l    #trkbufsiz,fib_Size(a2)
  785.         bne.s    reqcp5            ;if not right size, try next
  786.         lea    fib_FileName(a2),a0
  787.         move.l    a0,d1            ;ptr name
  788.         move.l    #MODE_OLDFILE,d2
  789.         jsr    _LVOOpen(a6)
  790.         move.l    d0,a5            ;handle
  791.         tst.l    d0
  792.         beq.s    reqcp5            ;if error, try next
  793.         move.l    d0,d1            ;handle
  794.         lea    fib_SIZEOF(a2),a0
  795.         move.l    a0,d2            ;read buffer ptr
  796.         move.l    #trkbufsiz,d3        ;size
  797.         jsr    _LVORead(a6)
  798.         move.l    d0,d2            ;ret code
  799.         move.l    a5,d1            ;handle
  800.         jsr    _LVOClose(a6)
  801.         moveq.l #-1,d0
  802.         cmp.l    d0,d2
  803.         beq.s    reqcp5            ;ir read err, try next
  804.  
  805. ;    a file of correct size is read, compare it
  806.  
  807.         move.w    #trkbufsiz/4-1,d0    ;loop count
  808.         move.l    d6,a0            ;current bootblock ptr
  809.         lea    fib_SIZEOF(a2),a1       ;read file ptr
  810. reqcp6:     cmp.l    (a0)+,(a1)+
  811.         bne.s    reqcp5            ;if not same, try next
  812.         dbra    d0,reqcp6        ;loop
  813.  
  814. ;    an identical file is found
  815. ;    move name to status buffer
  816.  
  817.         lea    bbfbmsg(pc),a5          ;status msg
  818.         lea    fib_FileName(a2),a0     ;name ptr
  819.         lea    bbfbmsgname(pc),a1      ;status name buffer ptr
  820.         moveq.l #bbfbmsgend-bbfbmsgname-1,d0 ;buffer cnt
  821. reqcp8:     move.b    (a0)+,(a1)+             ;name to buf
  822.         beq.s    reqcp7            ;if end of name
  823.         dbra    d0,reqcp8        ;loop
  824.         bra.s    reqcp4
  825. reqcp7:     subq.l    #1,a1            ;write over end mark
  826. reqcp9:     move.b    #' ',(a1)+
  827.         dbra    d0,reqcp9        ;fill with ' '
  828.         bra.s    reqcp4
  829.  
  830. ;    entry from : no lock or dir exhausted
  831.  
  832. reqcp3:     lea    bbnfmsg(pc),a5          ;no file msg
  833. reqcp4:     move.l    d5,d1            ;ptr to dir lock
  834.         jsr    _LVOUnLock(a6)          ;unlock dir
  835.  
  836. ;    free memory
  837. ;    entry from : no lock to compare directory
  838.  
  839. reqcp2:     move.l    d7,a6            ;_AbsExecBase
  840.         move.l    a2,a1            ;ptr
  841.         move.l    #fib_SIZEOF+trkbufsiz,d0 ;size
  842.         jsr    _LVOFreeMem(a6)
  843.         bra    reqstr5
  844.  
  845. ;    subroutines
  846.  
  847. ;    chkall
  848. ;    check the boot blocks in all floppy disk drives
  849. ;    if error is found : call reqstr
  850. ;    entry : a6=exec.library ptr
  851. ;    chg   : d0,d1,d2,d3,d4,d5
  852. ;        a0,a1,a2,a3,a4
  853.  
  854. chkall:     moveq.l #numdrv-1,d4        ;drive count
  855. chkall4:    bsr.s    chkone
  856.         tst.l    d5
  857.         beq.s    chkall3         ;if no error
  858.         subq.l    #nomem+1,d5
  859.         bmi.s    chkall1         ;if nodev/mem
  860.         subq.l    #3,d5
  861.         bmi.s    chkall3         ;if nodsk/chg/bot
  862.  
  863. ;    error found in boot block
  864.  
  865.         bsr    reqstr            ;handle response
  866.         move.l    d7,a6            ;_AbsExecBase
  867. chkall3:    bsr    chkoneend        ;chkone cleanup
  868. chkall1:    dbra    d4,chkall4        ;drive loop
  869.         rts
  870.  
  871. ;    chkone
  872. ;    check the boot blocks in one floppy disk drive
  873. ;      if the drive
  874. ;        is attached
  875. ;        has changed since last check
  876. ;        has a disk inserted
  877. ;    entry : d4=drive number, a6=exec.library ptr
  878. ;    exit  : d5=error code (see equates in beginning of file)
  879. ;        a3=io request ptr, a4=track buffer ptr, a5=msg string ptr
  880. ;    chg   : d0,d1,d2,d3,d5
  881. ;        a0,a1,a2,a3,a4,a5
  882.  
  883. ;    open trackdisk device
  884.  
  885. chkone:     moveq.l #nodev,d5        ;flg no device
  886.         move.l    #trkname,d2
  887.         move.l    #trknodename,d3
  888.         bsr    opendev
  889.         bne.s    chkone1         ;if open
  890. chkone4:    rts                ;exit if not possible to open
  891.  
  892. ;    allocate trackdisk buffer memory
  893.  
  894. chkone1:    move.l    IO_ACTUAL(a3),0(a0,d1)  ;update cnt
  895.         moveq.l #nomem,d5        ;flg no memory
  896.         move.l    #trkbufsiz,d0
  897.         move.l    #MEMF_CHIP,d1
  898.         jsr    _LVOAllocMem(a6)        ;get mem ptr
  899.         tst.l    d0
  900.         beq    closedev        ;if no mem
  901.         move.l    d0,a4            ;ptr
  902.  
  903. ;    check if the drive has a disk inserted
  904.  
  905.         bsr    tdstate
  906.         bne    chkone4         ;if no disk
  907.  
  908. ;    check if the drive has changed since last check
  909.  
  910.         move.w    #TD_CHANGENUM,IO_COMMAND(a3)
  911.         bsr    doiotst
  912.         lea    chgcnt(pc),a0
  913.         move.l    d4,d1
  914.         asl.l    #2,d1            ;long ptr
  915.         move.l    0(a0,d1),d0             ;last cnt
  916.         moveq.l #nochg,d5        ;flg no change
  917.         cmp.l    IO_ACTUAL(a3),d0
  918.         beq    chkone4         ;if no change
  919.         move.l    IO_ACTUAL(a3),0(a0,d1)  ;update cnt
  920.  
  921. ;    read block 0 and 1
  922.  
  923.         move.l    a4,IO_DATA(a3)          ;data ptr
  924.         move.l    #trkbufsiz,IO_LENGTH(a3) ;data size
  925.         move.w    #CMD_READ,IO_COMMAND(a3) ;read
  926.         clr.l    IO_OFFSET(a3)           ;start at block 0
  927.         bsr.s    doiotst
  928.         bsr    motoroff
  929.  
  930. ;    check code part of bootblock
  931.  
  932.         add.w    #1,chkcnt        ;one more checked
  933.         lea    bootstart(pc),a1        ;ptr to std data
  934.         move.l    a4,a0            ;ptr to read data
  935.         lea    bb5msg(pc),a5
  936.         moveq.l #nobot,d5        ;flg no bootdisk
  937.         cmp.l    (a0)+,(a1)+             ;chk type
  938.         bne.s    chkone7         ;if not a boot disk
  939.         moveq.l #((bootend-bootstart)/4)-2,d0 ;long size-2
  940.         moveq.l #nocod,d5        ;flg no boot code
  941.         lea    bb6msg(pc),a5
  942. chkone3:    cmp.l    (a0)+,(a1)+
  943.         bne.s    chkone5         ;if not std code
  944.         dbra    d0,chkone3        ;loop
  945.  
  946. ;    check cleared part of bootblock
  947.  
  948.         move.w    #bootsize/4-((bootend-bootstart)/4)-1,d0 ;long size of clr area
  949.         moveq.l #noclr,d5        ;flg error in clear area
  950.         lea    bb7msg(pc),a5
  951. chkone2:    tst.l    (a0)+
  952.         bne.s    chkone5         ;if not cleared
  953.         dbra    d0,chkone2        ;loop
  954.         lea    bb0msg(pc),a5
  955.         moveq.l #0,d5            ;flg no error
  956. chkone7:    rts
  957.  
  958. ;    if error
  959.  
  960. chkone5:    add.w    #1,vircnt        ;one more non std found
  961.         rts
  962.  
  963. ;    chkoneend
  964. ;    close device and free trackdisk buffer memory
  965. ;    entry : a3=io req ptr, a4=track buffer ptr, a6=_AbsExecBase
  966. ;    chg   : d0,d1
  967. ;        a0,a1,a2
  968.  
  969. chkoneend:    bsr    closedev
  970.         move.l    a4,a1            ;ptr
  971.         move.l    #trkbufsiz,d0        ;size
  972.         jmp    _LVOFreeMem(a6)
  973.  
  974. ;    doiotst
  975. ;    make a DoIO and tst IO_ACTUAL
  976. ;    entry : a3=io request, a6=_AbsExecBase
  977. ;    exit  : flags
  978. ;    chg   : d0,d1,a0,a1
  979.  
  980. doiotst:    move.l    a3,a1            ;ioreq ptr
  981.         jsr    _LVODoIO(a6)
  982.         tst.l    IO_ACTUAL(a3)
  983.         rts
  984.  
  985. ;    memchk
  986. ;    check jump tables of all resident libraries and all resident devices
  987. ;    jump address must be in rom or in private area of a resident library
  988. ;    entry : a3=startup window pointer, a6=_AbsExecBase
  989. ;    chg   : d0,d1,d2,d3,d5
  990. ;        a0,a1,a2,a5
  991.  
  992. ;    13->
  993. ;    allocate memory for lib & dev private begin & end ptrs
  994.  
  995. memchk:     move.l    #numlibs*2*4,d0     ;size
  996.         move.l    #MEMF_ANY+MEMF_CLEAR,d1
  997.         jsr    _LVOAllocMem(a6)        ;get mem ptr
  998.         move.l    d0,d5            ;mem ptr
  999.         bne.s    memchk1         ;if mem
  1000.         rts
  1001. memchk1:    move.l    d5,a5            ;size array ptr
  1002.         lea    firstlib(pc),a2         ;1:st lib name ptr
  1003.  
  1004. ;    set up array with library & device private begin & end
  1005.  
  1006.         lea    LibList(a6),a0          ;library header
  1007. memchk13:    move.l    a0,d3            ;header ptr
  1008. memchk3:    move.l    a2,a1            ;name
  1009.         move.l    d3,a0            ;header
  1010.         jsr    _LVOFindName(a6)
  1011.         tst.l    d0
  1012.         beq    memchk2         ;should not happen, get nxt
  1013.         move.l    d0,a0            ;lib or dev ptr
  1014.         lea    LIB_SIZE(a0),a1
  1015.         move.l    a1,(a5)+                ;1:st private
  1016.         move.w    LIB_POSSIZE(a0),d0
  1017.         add.w    d0,a0            ;1:st after private
  1018.         move.l    a0,(a5)+
  1019. memchk2:    tst.b    (a2)+
  1020.         bne.s    memchk2         ;find nxt name
  1021.         tst.b    (a2)
  1022.         bne    memchk3         ;if more names
  1023.         addq    #1,a2            ;skip end mark
  1024.         lea    LibList(a6),a0
  1025.         cmp.l    a0,d3
  1026.         lea    DeviceList(a6),a0       ;device header
  1027.         beq.s    memchk13        ;do device list
  1028.  
  1029. ;    library & device check loop
  1030.  
  1031.         lea    firstlib(pc),a2         ;1:st lib name ptr
  1032.         lea    LibList(a6),a0          ;library header
  1033. memchk14:    move.l    a0,d3            ;header ptr
  1034. memchk6:    move.l    a2,a1            ;name
  1035.         move.l    d3,a0            ;header
  1036.         jsr    _LVOFindName(a6)
  1037.         move.l    d0,d2
  1038.         move.l    d0,a0
  1039.         beq    memchk5         ;should not happen, chk nxt
  1040.         moveq.l #0,d0
  1041.         move.w    LIB_NEGSIZE(a0),d0      ;jump tab size
  1042.         beq.s    memchk5         ;should not happen, chk nxt
  1043.         divu    #6,d0            ;# of entries
  1044.         subq.l    #1,d0            ;use as loop cnt
  1045.  
  1046. ;    jump table check loop
  1047.  
  1048. memchk4:    subq.l    #6,a0            ;entry ptr
  1049.  
  1050. ;    check instruction
  1051.  
  1052.         move.w    (a0),d1                 ;instr
  1053.         move.l    2(a0),a1                ;jmp addr
  1054.         cmp.w    #jmpinst,d1
  1055.         beq.s    memchk7         ;if jmp
  1056.         cmp.w    #nopinst,d1
  1057.         beq.s    memchk8         ;if nop
  1058.         and.w    #moveqmask,d1
  1059.         cmp.w    #moveqinst,d1
  1060.         bne.s    memerr            ;if unknown instr
  1061.  
  1062. ;    moveq or nop instruction
  1063.  
  1064. memchk8:    move.l    2(a0),d1                ;get nxt instr
  1065.         swap    d1            ;instr to lo
  1066.         cmp.w    #brainst,d1
  1067.         bne.s    memerr            ;if unknown instr
  1068.  
  1069. ;    bra instruction
  1070.  
  1071.         swap    d1            ;offset to lo
  1072.         lea    2(a0),a1                ;instr addr
  1073.         add.w    d1,a1            ;jump target addr
  1074.  
  1075. ;    check jmp address against rom
  1076.  
  1077. memchk7:    cmp.l    #romstart,a1
  1078.         blt.s    memchk9         ;if addr before start
  1079.         cmp.l    #romend+1,a1
  1080.         blt.s    memchk10        ;if addr before end
  1081.  
  1082. ;    check jmp address against resident lib or dev private area
  1083.  
  1084. memchk9:    move.l    d5,a5            ;start of start/stop array
  1085.         moveq.l #numlibs-1,d1        ;loop cnt
  1086. memchk12:    cmp.l    (a5),a1
  1087.         blt.s    memchk11        ;if addr before start
  1088.         cmp.l    4(a5),a1
  1089.         blt.s    memchk10        ;if addr before end
  1090. memchk11:    addq.l    #8,a5            ;nxt start/stop pair
  1091.         dbra    d1,memchk12        ;loop
  1092.  
  1093. ;    suspicious jump address found
  1094.  
  1095.         bra.s    memerr
  1096.  
  1097. ;    one library or device is checked
  1098.  
  1099. memchk10:    dbra    d0,memchk4        ;tab loop
  1100. memchk5:    tst.b    (a2)+
  1101.         bne.s    memchk5         ;find nxt name
  1102.         tst.b    (a2)
  1103.         bne    memchk6         ;if more names
  1104.         addq    #1,a2            ;skip end mark
  1105.         lea    LibList(a6),a0
  1106.         cmp.l    a0,d3
  1107.         lea    DeviceList(a6),a0       ;device header
  1108.         beq    memchk14        ;do device list
  1109.  
  1110. ;    all libraries and devices are checked
  1111.  
  1112.         move.l    #numlibs*2*4,d0     ;size
  1113.         move.l    d5,a1
  1114.         jsr    _LVOFreeMem(a6)         ;get mem ptr
  1115.         rts
  1116.  
  1117. ;    errors
  1118.  
  1119. memerr:     movem.l d0/d2/d3/a0/a2/a3/a6,-(a7)
  1120.         move.l    intbase(pc),a6
  1121.  
  1122. ;    calculate offset into table and covert to decimal
  1123.  
  1124.         sub.l    a0,d2            ;offset into tab
  1125.         moveq.l #100,d1
  1126.         lea    memmsgnum(pc),a0
  1127. memerr1:    divu    d1,d2
  1128.         add.b    #'0',d2
  1129.         move.b    d2,(a0)+
  1130.         clr.b    d2
  1131.         swap    d2            ;rem to lo
  1132.         divu    #10,d1
  1133.         bne.s    memerr1         ;if more digits
  1134.  
  1135. ;    set up requester
  1136.  
  1137.         move.l    a3,a0            ;window ptr
  1138.         lea    membt1(pc),a1           ;boty text intuitext
  1139.         move.l    a2,membt2ptr
  1140.         sub.l    a2,a2            ;no positive text
  1141.         lea    memnt(pc),a3            ;negative text intuitext
  1142.         moveq.l #memreqw/4,d2        ;width
  1143.         asl.l    #2,d2
  1144.         moveq.l #memreqh,d3        ;height
  1145.         moveq.l #0,d0
  1146.         move.l    d0,d1            ;no IDCMP
  1147.         jsr    _LVOAutoRequest(a6)
  1148.         movem.l (a7)+,d0/d2/d3/a0/a2/a3/a6 ;restore
  1149.         bra.s    memchk10
  1150.  
  1151. ;    motoroff
  1152. ;    turn the motor off in a drive
  1153. ;    entry : a3=ptr to iorequest
  1154. ;    chg   : d0,d1
  1155. ;        a0,a1
  1156.  
  1157. motoroff:    moveq.l #0,d0
  1158.         move.l    d0,IO_LENGTH(a3)        ;motor state
  1159.         move.w    #TD_MOTOR,IO_COMMAND(a3)
  1160.         bra    doiotst
  1161.  
  1162. ;    opendev
  1163. ;    open the device, allocate a message port and allocate a StdIOReq
  1164. ;    entry : d2=ptr device name string, d3=ptr msgport node name string
  1165. ;        d4=unit #
  1166. ;        a6=exec.library ptr
  1167. ;    exit  : a3=ptr StdIOReq, z=failure
  1168. ;    chg   : d0,d1
  1169. ;        a0,a1,a2,a3
  1170.  
  1171. ;    get memory for port and iorequest
  1172.  
  1173. opendev:    moveq.l #MP_SIZE+IOSTD_SIZE,d0
  1174.         move.l    #MEMF_ANY+MEMF_PUBLIC+MEMF_CLEAR,d1
  1175.         jsr    _LVOAllocMem(a6)        ;get mem ptr
  1176.         tst.l    d0
  1177.         bne.s    opendev1
  1178.         rts                ;exit if no mem
  1179. opendev1:    move.l    d0,a2            ;msg port ptr
  1180.  
  1181. ;    allocate a signal
  1182.  
  1183.         moveq.l #-1,d0
  1184.         jsr    _LVOAllocSignal(a6)
  1185.         move.b    d0,MP_SIGBIT(a2)        ;signal #
  1186.         addq.l    #1,d0
  1187.         beq.s    opendev3        ;if failure
  1188.  
  1189. ;    add a MsgPort
  1190.  
  1191.         move.b    #NT_MSGPORT,LN_TYPE(a2) ;node type
  1192.         move.l    d3,LN_NAME(a2)          ;node name
  1193.         move.b    #PA_SIGNAL,MP_FLAGS(a2) ;action type
  1194.         sub.l    a1,a1
  1195.         jsr    _LVOFindTask(a6)
  1196.         move.l    d0,MP_SIGTASK(a2)       ;task ptr
  1197.         move.l    a2,a1
  1198.         jsr    _LVOAddPort(a6)
  1199.  
  1200. ;    open the device
  1201.  
  1202.         lea    MP_SIZE(a2),a3          ;IOStdReq ptr
  1203.         move.l    a2,MN_REPLYPORT(a3)     ;ptr port
  1204.         move.w    #IOSTD_SIZE-MN_SIZE,MN_LENGTH(a3) ;msg size
  1205.         move.l    d2,a0            ;dev name
  1206.         move.l    d4,d0            ;unit #
  1207.         move.l    a3,a1            ;ptr StdIOReq
  1208.         moveq.l #0,d1            ;flgs
  1209.         jsr    _LVOOpenDevice(a6)
  1210.         or.l    d0,d0
  1211.         bne.s    opendev2        ;if error
  1212.         moveq.l #1,d0            ;flg no error
  1213.         rts
  1214.  
  1215. ;    back out safely and don't destroy anything
  1216. ;    remove signal and port
  1217.  
  1218. opendev2:    moveq.l #0,d0
  1219.         move.b    MP_SIGBIT(a2),d0        ;signal #
  1220.         jsr    _LVOFreeSignal(a6)
  1221.         move.l    a2,a1
  1222.         jsr    _LVORemPort(a6)
  1223.         moveq.l #0,d0            ;flg error
  1224.  
  1225. ;    free message port and io request memory
  1226.  
  1227. opendev3:    move.l    a2,a1            ;msgport ptr
  1228.         move.l    #MP_SIZE+IOSTD_SIZE,d0    ;size
  1229.         jsr    _LVOFreeMem(a6)
  1230.         moveq.l #0,d0            ;flg failure
  1231.         rts                ;exit if no alloc
  1232.  
  1233. ;    closedev
  1234. ;    remove the message port and close the device
  1235. ;    entry : a3=ptr to a associated IoReq
  1236. ;        a6=exec.library ptr
  1237. ;    chg   : d0,d1
  1238. ;        a0,a1,a2
  1239.  
  1240. closedev:    move.l    MN_REPLYPORT(a3),a2     ;msgport ptr
  1241.         move.l    a3,a1            ;io request ptr
  1242.         jsr    _LVOCloseDevice(a6)
  1243.         bra.s    opendev2
  1244.  
  1245. ;    prttxt
  1246. ;    print intui text in a window, using genit struct
  1247. ;    entry : d0=x coord, d1=y coord
  1248. ;        a4=ptr to window, a6=intbase
  1249. ;    chg   : d0,d1
  1250. ;        a0,a1
  1251.  
  1252. prttxt:     move.l    wd_RPort(a4),a0         ;rast port ptr
  1253.         lea    genit(pc),a1            ;ptr to intuitext struct
  1254.         jmp    _LVOPrintIText(a6)
  1255.  
  1256. ;    reschgcnt
  1257. ;    reset change counter for a drive
  1258. ;    entry : d4=drive #
  1259. ;    chg   : d0,d1,d0
  1260.  
  1261. reschgcnt:    lea    chgcnt(pc),a0
  1262.         move.l    d4,d1
  1263.         asl.l    #2,d1            ;long ptr
  1264.         moveq.l #0,d0
  1265.         move.l    d0,0(a0,d1)             ;force change
  1266.         rts
  1267.  
  1268. ;    tdstate
  1269. ;    check if drive has disk inserted
  1270. ;    entry : a3=io request, a6=_AbsExecBase
  1271. ;    exit  : z=disk in drive
  1272. ;    chg   : d0,d1,d5
  1273. ;        a0,a1,a5
  1274.  
  1275. tdstate:    lea    bb3msg(pc),a5
  1276.         moveq.l #nodsk,d5        ;flg no disk
  1277.         move.w    #TD_CHANGESTATE,IO_COMMAND(a3)
  1278.         bra    doiotst
  1279.  
  1280. ;    normal boot code, to check bootblock against
  1281. ;    bootcode
  1282. ;    execution starts 12 bytes into block 0
  1283. ;    entry : a6=exec lib ptr
  1284. ;    exit  : d0=failure code, 0=ok
  1285. ;        a0=ptr to boot routine
  1286.  
  1287. ;    data area
  1288.  
  1289. bootstart:    dc.b    "DOS",0                 ;4 byte id
  1290.         dc.l    $c0200f19        ;chksum
  1291.         dc.l    $00000370        ;dos patch
  1292.  
  1293. ;    start execution here
  1294.  
  1295. bootentry:    lea    bootname(pc),a1         ;ptr lib name
  1296.         jsr    _LVOFindResident(a6)
  1297.         tst.l    d0
  1298.         beq.s    booterror        ;if lib ptr = 0
  1299.  
  1300. ;    dos library found
  1301.  
  1302.         movea.l d0,a0            ;lib ptr
  1303.         movea.l RT_INIT(a0),a0          ;ptr to resident init code
  1304.         moveq.l #0,d0            ;flg no error
  1305. bootexit:    rts
  1306. booterror:    moveq.l #-1,d0            ;flg error
  1307.         bra.s    bootexit
  1308.  
  1309. ;    data area
  1310.  
  1311. bootname:    dc.b    "dos.library",0
  1312.         dc.w    0            ;align to long size
  1313. bootend:
  1314.  
  1315. ;    the rest is cleared
  1316.  
  1317. ;         dcb.b      bootsize-(bootend-bootstart),0
  1318.  
  1319. ;    end of normal bootblock
  1320.  
  1321. ;    data area
  1322. ;    initialized data area
  1323. ;    name strings of resident libraries and devices
  1324.  
  1325. numlibs     equ    16            ;number of libs & devs
  1326.  
  1327. firstlib:
  1328. dosname:    dc.b    'dos.library',0
  1329.         dc.b    'exec.library',0
  1330.         dc.b    'expansion.library',0
  1331.         dc.b    'graphics.library',0
  1332. intname:    dc.b    'intuition.library',0
  1333.         dc.b    'layers.library',0
  1334.         dc.b    'mathffp.library',0
  1335.         dc.b    'romboot.library',0
  1336.         dc.b    'ramlib.library',0
  1337.         dc.b    0            ;end of libraries
  1338.         dc.b    'keyboard.device',0
  1339.         dc.b    'gameport.device',0
  1340.         dc.b    'timer.device',0
  1341.         dc.b    'audio.device',0
  1342.         dc.b    'input.device',0
  1343.         dc.b    'console.device',0
  1344.         dc.b    'trackdisk.device',0
  1345.         dc.b    0            ;end of devices
  1346.  
  1347. ;    error messages from memchk
  1348.  
  1349. memmsg:     dc.b    'Suspicious entry at -'
  1350. memmsgnum:    dc.b    '    ',0
  1351.  
  1352. ;    various strings
  1353.  
  1354. cpdev:        dc.b    'ngcbb:',0
  1355. trkname:    dc.b    'trackdisk.device',0
  1356. trknodename:    dc.b    'NGC trk',0
  1357.  
  1358. ;    startup window data area
  1359. ;    title
  1360.  
  1361. wintitle:    dc.b    'NGC',0
  1362.  
  1363. ;    NewWindow struct
  1364.  
  1365. window:     dc.w    winx,winy        ;top x,y
  1366.         dc.w    winw,winh        ;width, height
  1367.         dc.b    windp,winbp        ;detail, block pen
  1368.         dc.l    winidcmp        ;idcmp flags
  1369.         dc.l    WINDOWDRAG+WINDOWDEPTH+WINDOWCLOSE+NOCAREREFRESH+RMBTRAP ;window flags
  1370.         dc.l    0            ;ptr 1st gadget
  1371.         dc.l    0            ;ptr checkmark
  1372.         dc.l    wintitle        ;ptr title
  1373.         dc.l    0            ;ptr screen
  1374.         dc.l    0            ;ptr bit map
  1375.         dc.w    0,0            ;min width height
  1376.         dc.w    0,0            ;max width height
  1377.         dc.w    WBENCHSCREEN        ;screen type
  1378.  
  1379. ;    control window data area
  1380. ;    status messages
  1381.  
  1382. bb0msg:     dc.b    "Standard bootcode    ",0
  1383. bb3msg:     dc.b    "No disk inserted     ",0
  1384. bb5msg:     dc.b    "Not a bootable disk  ",0
  1385. bb6msg:     dc.b    "Not standard bootcode",0
  1386. bb7msg:     dc.b    "Data in clear part   ",0
  1387. bbnfmsg:    dc.b    "No identical file    ",0
  1388. bbwpmsg:    dc.b    "Write protected disk ",0
  1389. bbfbmsg:    dc.b    "Found: ",
  1390. bbfbmsgname:    dc.b    "              "
  1391. bbfbmsgend:    dc.b    0
  1392. bbdigit:    dc.b    " ",0
  1393.  
  1394. ;    fixed text
  1395. ;    x,y coords
  1396. ;    string
  1397. ;    end with x coord = zero
  1398.  
  1399. ctltxt:     dc.b    ctlcotx,ctlcoty
  1400.         dc.b    'Continue',0
  1401.         dc.b    ctlsatx,ctlsaty
  1402.         dc.b    'Save',0
  1403.         dc.b    ctlintx,ctlinty
  1404.         dc.b    'Install',0
  1405.         dc.b    ctlfntx,ctlfnty
  1406.         dc.b    'Save as file :',0
  1407.         dc.b    ctlcdx,ctlcdy
  1408.         dc.b    'Current drive is df',0
  1409. ctltxtch:    dc.b    0,ctlchty        ;temp end
  1410.         dc.b    'Check',0
  1411.         dc.b    ctlpltx,ctlplty
  1412.         dc.b    ' + ',0
  1413.         dc.b    ctlmitx,ctlmity
  1414.         dc.b    ' - ',0
  1415.         dc.b    ctlcptx,ctlcpty
  1416.         dc.b    'Compare',0
  1417.         dc.b    0            ;end
  1418.  
  1419. ;    fixed borders
  1420. ;    5 x,y coord pairs per box
  1421. ;    end with x coord = 0
  1422.  
  1423. ctlbrd:     dc.w    ctlcox,ctlcoy        ;continue   0  2
  1424.         dc.w    ctlcox,ctlcoy+ctlcoh-1           ;4  6
  1425.         dc.w    ctlcox+ctlcow-1,ctlcoy+ctlcoh-1    ;8  10
  1426.         dc.w    ctlcox+ctlcow-1,ctlcoy           ;12 14
  1427.         dc.w    ctlcox,ctlcoy               ;16 18
  1428.         dc.w    ctlsax,ctlsay        ;save
  1429.         dc.w    ctlsax,ctlsay+ctlsah-1
  1430.         dc.w    ctlsax+ctlsaw-1,ctlsay+ctlsah-1
  1431.         dc.w    ctlsax+ctlsaw-1,ctlsay
  1432.         dc.w    ctlsax,ctlsay
  1433.         dc.w    ctlinx,ctliny        ;install
  1434.         dc.w    ctlinx,ctliny+ctlinh-1
  1435.         dc.w    ctlinx+ctlinw-1,ctliny+ctlinh-1
  1436.         dc.w    ctlinx+ctlinw-1,ctliny
  1437.         dc.w    ctlinx,ctliny
  1438.         dc.w    ctlfnx-3,ctlfny-2        ;file name
  1439.         dc.w    ctlfnx-3,ctlfny+ctlfnh-1
  1440.         dc.w    ctlfnx+ctlfnw,ctlfny+ctlfnh-1
  1441.         dc.w    ctlfnx+ctlfnw,ctlfny-2
  1442.         dc.w    ctlfnx-3,ctlfny-2
  1443. ctlbrdch:    dc.w    0,ctlchy        ;check (temp end)
  1444.         dc.w    ctlchx,ctlchy+ctlchh-1
  1445.         dc.w    ctlchx+ctlchw-1,ctlchy+ctlchh-1
  1446.         dc.w    ctlchx+ctlchw-1,ctlchy
  1447.         dc.w    ctlchx,ctlchy
  1448.         dc.w    ctlplx,ctlply        ;plus
  1449.         dc.w    ctlplx,ctlply+ctlplh-1
  1450.         dc.w    ctlplx+ctlplw-1,ctlply+ctlplh-1
  1451.         dc.w    ctlplx+ctlplw-1,ctlply
  1452.         dc.w    ctlplx,ctlply
  1453.         dc.w    ctlmix,ctlmiy        ;minus
  1454.         dc.w    ctlmix,ctlmiy+ctlmih-1
  1455.         dc.w    ctlmix+ctlmiw-1,ctlmiy+ctlmih-1
  1456.         dc.w    ctlmix+ctlmiw-1,ctlmiy
  1457.         dc.w    ctlmix,ctlmiy
  1458.         dc.w    ctlcpx,ctlcpy        ;compare
  1459.         dc.w    ctlcpx,ctlcpy+ctlcph-1
  1460.         dc.w    ctlcpx+ctlcpw-1,ctlcpy+ctlcph-1
  1461.         dc.w    ctlcpx+ctlcpw-1,ctlcpy
  1462.         dc.w    ctlcpx,ctlcpy
  1463.         dc.w    0            ;end
  1464.  
  1465. ;    control window NewWindow struct
  1466.  
  1467. ctlwin:     dc.w    0,0            ;top x,y (to be set)
  1468.         dc.w    ctlwinw,ctlwinh     ;width, height
  1469.         dc.b    windp,winbp        ;detail, block pen
  1470.         dc.l    GADGETUP+DISKINSERTED    ;idcmp flags
  1471.         dc.l    WINDOWDRAG+WINDOWDEPTH+NOCAREREFRESH ;window flags
  1472.         dc.l    ctlco            ;ptr 1st gadget
  1473.         dc.l    0            ;ptr checkmark
  1474.         dc.l    civer            ;ptr title
  1475.         dc.l    0            ;ptr screen
  1476.         dc.l    0            ;ptr bit map
  1477.         dc.w    0,0            ;min width height
  1478.         dc.w    0,0            ;max width height
  1479.         dc.w    WBENCHSCREEN        ;screen type
  1480.  
  1481. ;    input window gadget structs
  1482. ;    continue
  1483.  
  1484. ctlco:        dc.l    ctlsa            ;ptr nxt gadget
  1485.         dc.w    ctlcox,ctlcoy        ;top x,y
  1486.         dc.w    ctlcow,ctlcoh        ;width, height
  1487.         dc.w    GADGHCOMP        ;flags
  1488.         dc.w    RELVERIFY        ;activation
  1489.         dc.w    BOOLGADGET        ;gadget type
  1490.         dc.l    0            ;ptr gadget render
  1491.         dc.l    0            ;ptr select render
  1492.         dc.l    0            ;ptr gadget txt
  1493.         dc.l    0            ;mutual exclude
  1494.         dc.l    0            ;ptr spec info
  1495.         dc.w    coid            ;id#
  1496.         dc.l    0            ;ptr user data
  1497.  
  1498. ;    save
  1499.  
  1500. ctlsa:        dc.l    ctlin            ;ptr nxt gadget
  1501.         dc.w    ctlsax,ctlsay        ;top x,y
  1502.         dc.w    ctlsaw,ctlsah        ;width, height
  1503.         dc.w    GADGHCOMP        ;flags
  1504.         dc.w    RELVERIFY        ;activation
  1505.         dc.w    BOOLGADGET        ;gadget type
  1506.         dc.l    0            ;ptr gadget render
  1507.         dc.l    0            ;ptr select render
  1508.         dc.l    0            ;ptr gadget txt
  1509.         dc.l    0            ;mutual exclude
  1510.         dc.l    0            ;ptr spec info
  1511.         dc.w    said            ;id#
  1512.         dc.l    0            ;ptr user data
  1513.  
  1514. ;    install
  1515.  
  1516. ctlin:        dc.l    ctlfn            ;ptr nxt gadget
  1517.         dc.w    ctlinx,ctliny        ;top x,y
  1518.         dc.w    ctlinw,ctlinh        ;width, height
  1519.         dc.w    GADGHCOMP        ;flags
  1520.         dc.w    RELVERIFY        ;activation
  1521.         dc.w    BOOLGADGET        ;gadget type
  1522.         dc.l    0            ;ptr gadget render
  1523.         dc.l    0            ;ptr select render
  1524.         dc.l    0            ;ptr gadget txt
  1525.         dc.l    0            ;mutual exclude
  1526.         dc.l    0            ;ptr spec info
  1527.         dc.w    inid            ;id#
  1528.         dc.l    0            ;ptr user data
  1529.  
  1530. ;    filename
  1531.  
  1532. ctlfn:        dc.l    0            ;ptr nxt gadget
  1533.         dc.w    ctlfnx,ctlfny        ;top x,y
  1534.         dc.w    ctlfnw,ctlfnh        ;width, height
  1535.         dc.w    SELECTED+GADGHCOMP    ;flags
  1536.         dc.w    RELVERIFY        ;activation
  1537.         dc.w    STRGADGET        ;gadget type
  1538.         dc.l    0            ;ptr gadget render
  1539.         dc.l    0            ;ptr select render
  1540.         dc.l    0            ;ptr gadget txt
  1541.         dc.l    0            ;mutual exclude
  1542.         dc.l    ctlfninfo        ;ptr spec info
  1543.         dc.w    fnid            ;id#
  1544.         dc.l    0            ;ptr user data
  1545.  
  1546. ;    special info for filename gadget
  1547.  
  1548. ctlfninfo:    dc.l    strbuf            ;ptr buffer
  1549.         dc.l    undobuf         ;ptr undo buffer
  1550.         dc.w    0            ;init buf pos
  1551.         dc.w    strbufsiz+1        ;buf size
  1552.         dc.w    0            ;pos of 1:st disp chr
  1553.         dc.w    0            ;pos in undo buf
  1554.         dc.w    0            ;# chr in buf
  1555.         dc.w    0            ;# chr disp
  1556.         dc.w    0,0            ;top x,y
  1557.         dc.l    0            ;ptr layer
  1558.         dc.l    0            ;result if int gadget
  1559.         dc.l    0            ;ptr alt key map
  1560.  
  1561. ;    check
  1562.  
  1563. ctlch:        dc.l    ctlpl            ;ptr nxt gadget
  1564.         dc.w    ctlchx,ctlchy        ;top x,y
  1565.         dc.w    ctlchw,ctlchh        ;width, height
  1566.         dc.w    GADGHCOMP        ;flags
  1567.         dc.w    RELVERIFY        ;activation
  1568.         dc.w    BOOLGADGET        ;gadget type
  1569.         dc.l    0            ;ptr gadget render
  1570.         dc.l    0            ;ptr select render
  1571.         dc.l    0            ;ptr gadget txt
  1572.         dc.l    0            ;mutual exclude
  1573.         dc.l    0            ;ptr spec info
  1574.         dc.w    chid            ;id#
  1575.         dc.l    0            ;ptr user data
  1576.  
  1577. ;    plus
  1578.  
  1579. ctlpl:        dc.l    ctlmi            ;ptr nxt gadget
  1580.         dc.w    ctlplx,ctlply        ;top x,y
  1581.         dc.w    ctlplw,ctlplh        ;width, height
  1582.         dc.w    GADGHCOMP        ;flags
  1583.         dc.w    RELVERIFY        ;activation
  1584.         dc.w    BOOLGADGET        ;gadget type
  1585.         dc.l    0            ;ptr gadget render
  1586.         dc.l    0            ;ptr select render
  1587.         dc.l    0            ;ptr gadget txt
  1588.         dc.l    0            ;mutual exclude
  1589.         dc.l    0            ;ptr spec info
  1590.         dc.w    plid            ;id#
  1591.         dc.l    0            ;ptr user data
  1592.  
  1593. ;    minus
  1594.  
  1595. ctlmi:        dc.l    ctlcp            ;ptr nxt gadget
  1596.         dc.w    ctlmix,ctlmiy        ;top x,y
  1597.         dc.w    ctlmiw,ctlmih        ;width, height
  1598.         dc.w    GADGHCOMP        ;flags
  1599.         dc.w    RELVERIFY        ;activation
  1600.         dc.w    BOOLGADGET        ;gadget type
  1601.         dc.l    0            ;ptr gadget render
  1602.         dc.l    0            ;ptr select render
  1603.         dc.l    0            ;ptr gadget txt
  1604.         dc.l    0            ;mutual exclude
  1605.         dc.l    0            ;ptr spec info
  1606.         dc.w    miid            ;id#
  1607.         dc.l    0            ;ptr user data
  1608.  
  1609. ;    compare
  1610.  
  1611. ctlcp:        dc.l    0            ;ptr nxt gadget
  1612.         dc.w    ctlcpx,ctlcpy        ;top x,y
  1613.         dc.w    ctlcpw,ctlcph        ;width, height
  1614.         dc.w    GADGHCOMP        ;flags
  1615.         dc.w    RELVERIFY        ;activation
  1616.         dc.w    BOOLGADGET        ;gadget type
  1617.         dc.l    0            ;ptr gadget render
  1618.         dc.l    0            ;ptr select render
  1619.         dc.l    0            ;ptr gadget txt
  1620.         dc.l    0            ;mutual exclude
  1621.         dc.l    0            ;ptr spec info
  1622.         dc.w    cpid            ;id#
  1623.         dc.l    0            ;ptr user data
  1624.  
  1625. ;    generic intuitext struct
  1626.  
  1627. genit:        dc.b    winbp,windp        ;front, back pen
  1628.         dc.b    RP_JAM2         ;draw mode
  1629.         dc.b    0            ;word align fill
  1630.         dc.w    0,0            ;top x,y
  1631.         dc.l    0            ;ptr font
  1632. genitptr:    dc.l    0            ;ptr text, (to be set)
  1633.         dc.l    0            ;ptr next intui text
  1634.  
  1635. ;    requester first bodytext intuitext struct
  1636.  
  1637. membt1:     dc.b    windp,winbp        ;front, back pen
  1638.         dc.b    RP_JAM2         ;draw mode
  1639.         dc.b    0            ;word align fill
  1640.         dc.w    2*chrw,chrh        ;top x,y
  1641.         dc.l    0            ;ptr font
  1642.         dc.l    memmsg            ;ptr text
  1643.         dc.l    membt2            ;ptr next intui text
  1644.  
  1645. ;    requester second bodytext intuitext struct
  1646.  
  1647. membt2:     dc.b    windp,winbp        ;front, back pen
  1648.         dc.b    RP_JAM2         ;draw mode
  1649.         dc.b    0            ;word align fill
  1650.         dc.w    2*chrw,3*chrh        ;top x,y
  1651.         dc.l    0            ;ptr font
  1652. membt2ptr:    dc.l    0            ;ptr text, (to be set)
  1653.         dc.l    0            ;ptr next intui text
  1654.  
  1655. ;    requester negative intuitext struct
  1656.  
  1657. memnt:        dc.b    windp,winbp        ;front, back pen
  1658.         dc.b    RP_JAM2         ;draw mode
  1659.         dc.b    0            ;word align fill
  1660.         dc.w    7,3            ;top x,y
  1661.         dc.l    0            ;ptr font
  1662.         dc.l    1$            ;ptr text
  1663.         dc.l    0            ;ptr next intui text
  1664.  
  1665. 1$:        dc.b    'Continue',0
  1666.  
  1667. ;    generic border struct, for boxes (5 pairs)
  1668.  
  1669. genbd:        dc.w    0,0            ;top x,y
  1670.         dc.b    winbp,windp        ;front, back pen
  1671.         dc.b    RP_JAM2         ;draw mode
  1672.         dc.b    5            ;# coord pairs
  1673. genbdptr:    dc.l    0            ;ptr coord pairs, (to be set)
  1674.         dc.l    0            ;nxt border
  1675.  
  1676. ;    library pointers
  1677.  
  1678. libstart:
  1679. dosbase:    dc.l    0
  1680. intbase:    dc.l    0
  1681.         dc.l    -1            ;last
  1682.  
  1683. ;    various initialized data
  1684. ;    long
  1685.  
  1686. chgcnt:     dcb.l    4,0            ;change count for each drive
  1687.  
  1688. ;    word
  1689.  
  1690. chkcnt:     dc.w    0            ;no of checked disks
  1691. instcnt:    dc.w    0            ;no of installed disks
  1692. vircnt:     dc.w    0            ;no of nonstd bootblocks
  1693.  
  1694. ;    byte
  1695. ;    for file name string gadget
  1696.  
  1697. strbuf:     dc.b    'ngcbb:',0              ;initial value
  1698. strbuf1:
  1699.         ds.b    strbufsiz-(strbuf1-strbuf-1) ;remaining
  1700. undobuf:    dc.b    0            ;empty a start
  1701.         ds.b    strbufsiz
  1702. lastdrv:    dc.b    0            ;last drive # used
  1703.  
  1704. ;    various uninitialized data
  1705. ;    long
  1706.  
  1707. spsave:     ds.l    1            ;init sp
  1708.  
  1709.         end
  1710.  
  1711.